<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      /*
      1. exec 正则匹配字符串，如果匹配成功返回第一次匹配结果，否则返回null
      2. test 正则匹配字符串，如果匹配成功返回true，否则返回false
      */
      const str = "abc";
      console.log(/[xy]/.exec(str));
      console.log(/[ay]/.test(str));
    </script>
  </body>
</html>
